import axios from "axios"
const http = axios.create({
    baseURL:"http://localhost:8080",
    timeout:10000
})
// 请求代理拦截
axios.interceptors.request.use(function (config){
    console.log(config);
    console.log(config.headers.Authorization);
    // 添加请求头的token
    config.headers["Authorization"] = "abcde";
    return config;
},function(error){
    return Promise.reject(error);
})
// 响应拦截
axios.interceptors.response.use(function (response) {
    console.log(response);
    switch(response.status){
        case 200:
            console.log("200请求成功");
            break;

    }
    return response;
},function (error) {
    return Promise.reject(error);
})
export default http;